package cn.weakup.designpattern.c_structural.decorator.usepattern;

import cn.weakup.designpattern.c_structural.decorator.HandlerInterceptor;

/**
 * @author lixj
 * @version 1.0.0
 * @date 2022/6/4
 * @desc 抽象类装饰⻆⾊(Decorator)
 *       在装饰类中有两个重点的地⽅是；1)继承了处理接⼝、2)提供了构造函数、3)覆盖了⽅法preHandle 。
 *       以上三个点是装饰器模式的核⼼处理部分，这样可以踢掉对⼦类继承的⽅式实现逻辑功能扩展
 */
public abstract class SsoDecorator implements HandlerInterceptor {

    private HandlerInterceptor handlerInterceptor;

    private SsoDecorator(){}

    public SsoDecorator(HandlerInterceptor handlerInterceptor){
        this.handlerInterceptor = handlerInterceptor;
    }

    @Override
    public boolean preHandle(String request, String response, Object handler) {
        return handlerInterceptor.preHandle(request, response, handler);
    }
}
